using System.Threading;
using Microsoft.VisualStudio.TestTools.UnitTesting;

namespace SmallBasicFun.Tests
{
	[TestClass]
	public class TimerTest
	{
		private decimal ticks;

		[TestMethod]
		public void TestTimer()
		{
            Timer.Clear();
			Timer.Tick += Tick;
			Timer.Start(1);
			while (ticks < 5)
			{
				Thread.Sleep(10);
			}
			Assert.AreEqual(ticks,5);
		}
		public void Tick()
		{
			ticks++;
			if (ticks == 5)
			{
				Timer.Stop();
			}
		}
	}
}